﻿using BW.WMS.Application.Features.Warehouse.Dtos;
using BW.WMS.Core.Result;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BW.WMS.Application.Features.Warehouse.Interfaces
{
    /// <summary>
    /// WMS仓库管理—仓库服务接口层
    /// </summary>
    public interface IWMS_WarehouseService
    {
        /// <summary>
        /// 获取仓库分页列表
        /// </summary>
        /// <param name="queryDto">查询条件</param>
        /// <returns>分页结果</returns>
        Task<ApiPage<WMS_WarehouseDto>> GetWarehousePageListAsync(WMS_WarehouseQueryDto queryDto);

        /// <summary>
        /// 根据ID获取仓库详情
        /// </summary>
        /// <param name="id">仓库ID</param>
        /// <returns>仓库详情</returns>
        Task<ApiResult<WMS_WarehouseDto>> GetWarehouseByIdAsync(long id);

        /// <summary>
        /// 创建仓库
        /// </summary>
        /// <param name="createDto">创建数据</param>
        /// <returns>操作结果</returns>
        Task<ApiResult<long>> CreateWarehouseAsync(WMS_WarehouseCreateDto createDto);

        /// <summary>
        /// 更新仓库
        /// </summary>
        /// <param name="updateDto">更新数据</param>
        /// <returns>操作结果</returns>
        Task<ApiResult<bool>> UpdateWarehouseAsync(WMS_WarehouseUpdateDto updateDto);

        /// <summary>
        /// 删除仓库
        /// </summary>
        /// <param name="id">仓库ID</param>
        /// <param name="updatedBy">操作人</param>
        /// <returns>操作结果</returns>
        Task<ApiResult<bool>> DeleteWarehouseAsync(long id);

        /// <summary>
        /// 批量删除仓库
        /// </summary>
        /// <param name="ids">仓库ID集合</param>
        /// <param name="updatedBy">操作人</param>
        /// <returns>操作结果</returns>
        Task<ApiResult<bool>> BatchDeleteWarehousesAsync(List<long> ids);

        /// <summary>
        /// 更新仓库状态
        /// </summary>
        /// <param name="id">仓库ID</param>
        /// <param name="status">状态(1=启用，2=停用，3=锁定)</param>
        /// <param name="updatedBy">操作人</param>
        /// <returns>操作结果</returns>
        Task<ApiResult<bool>> UpdateWarehouseStatusAsync(long id, int status, string updatedBy);

        /// <summary>
        /// 获取所有部门列表（树形结构），用于下拉选择框
        /// </summary>
        /// <param name="parentId">父级部门ID，默认为0表示获取顶级部门</param>
        /// <returns>部门树形结构数据</returns>
        Task<ApiResult<List<DepartmentTreeDto>>> GetAllDepartmentsTreeAsync(long parentId = 0);

        /// <summary>
        /// 获取所有仓库主管列表，用于下拉选择框
        /// </summary>
        /// <param name="departmentId">部门ID，可选参数，用于筛选特定部门的主管</param>
        /// <returns>主管ID和名称的键值对列表</returns>
        Task<ApiResult<List<KeyValuePair<long, string>>>> GetAllManagersAsync(long? departmentId = null);
    }
}
